package com.blackman.skcrawler.core.crawler.vo;

import com.blackman.skcrawler.core.crawler.po.WormPendPage;

import java.util.ArrayList;
import java.util.List;

/**
 * 爬虫参数设置
 *
 * @author staywood
 * @date 2018/04/04 14:32
 *
 */
public class CrawlerParam {

    private String theadstr = String.valueOf(System.nanoTime());

    // 线程中默认取待抓取数量
    protected Integer DEFAULT_GET_PENDPAGE_NUM = 100;

    /**
     * 定义爬虫name
     */
    private String crawlerName;

    /**
     * 起始页集合
     *
     * 【抓取网页链接最初入库链接】
     *
     */
    private List<String> homePageList = new ArrayList<String>();

    /**
     * 匹配正则规则集合
     *
     * 【抓取匹配正则集合的链接】
     *
     */
    private List<String> regularList = new ArrayList<String>();

    /**
     * 动态种子
     *
     * 【抓取过程中发现其他链接，将匹配该原则进入待抓取队列】
     *
     */
    private List<String> seedList = new ArrayList<String>();

    /**
     * 待抓取链接
     */
    private List<WormPendPage> grabUrlList = new ArrayList<WormPendPage>();

    /**
     * 线程数
     *
     */
    private Integer threadNum = 5;

    /**
     * 新增起始页
     * @param homePageurl
     */
    public void addHomePage(String homePageurl){
        this.getHomePageList().add(homePageurl);
    }


    /**
     * 新增正则匹配url
     * @param regular
     */
    public void addRegular(String regular){
        this.getRegularList().add(regular);
    }

    /**
     * 新增匹配种子规则
     * @param seed
     */
    public void addSeed(String seed){
        this.getSeedList().add(seed);
    }


    public List<String> getHomePageList() {
        return homePageList;
    }

    public void setHomePageList(List<String> homePageList) {
        this.homePageList = homePageList;
    }

    public List<String> getRegularList() {
        return regularList;
    }

    public void setRegularList(List<String> regularList) {
        this.regularList = regularList;
    }

    public Integer getThreadNum() {
        return threadNum;
    }

    public void setThreadNum(Integer threadNum) {
        this.threadNum = threadNum;
    }

    public List<WormPendPage> getGrabUrlList() {
        return grabUrlList;
    }

    public void setGrabUrlList(List<WormPendPage> grabUrlList) {
        this.grabUrlList = grabUrlList;
    }

    public List<String> getSeedList() {
        return seedList;
    }

    public void setSeedList(List<String> seedList) {
        this.seedList = seedList;
    }

    public String getCrawlerName() {
        return crawlerName;
    }

    public void setCrawlerName(String crawlerName) {
        this.crawlerName = crawlerName;
    }
}
